import Tween = Laya.Tween;
import Common from "../Common/common"
export default class TitleSlide extends Laya.Script{
    private scaleDelta: number = 0;
	constructor(){
        super();
        Common.timeArray.push(this)
    }

    onAwake(){
        Laya.timer.once(500,this,this.upward);
        // Laya.timer.once(1500,this,this.animate);
    }

    private animate(e: Event): void {
        //心跳缩放
        Laya.timer.frameLoop(2, this, ()=>{
            this.scaleDelta += 0.01;
            var scaleValue: number = Math.abs(Math.sin(this.scaleDelta))/2+0.8;
            this.owner.scale(scaleValue, scaleValue);
        });
    }
   
    upward(){
        this.owner.y = 130
        Tween.to(this.owner,{y : 600},1000,Laya.Ease.elasticOut)
    }
    
}